package org.nestor.demo.server;

import io.grpc.Server;
import io.grpc.ServerBuilder;
import org.nestor.demo.service.RPCDateServiceImpl;

import java.io.IOException;

/**
 * grpc服务端
 *
 * @author : Nestor.Bian
 * @version : V 1.0
 * @date : 2025/3/4
 */
public class GRPCServer {
    private static final int port = 9999;

    public static void main(String[] args) throws IOException, InterruptedException {
        final Server server = ServerBuilder.forPort(port).addService(new RPCDateServiceImpl()).build();
        server.start();
        System.out.println("grpc server started now, port: " + port);
        server.awaitTermination();
    }
}